package com.wimcorp.magic.abilities.trigger;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToOne;

import com.wimcorp.magic.abilities.Ability;
import com.wimcorp.magic.abilities.Suspend;
@Entity
public class OnUnSuspend extends AbilityTrigger{

	@OneToOne(fetch = FetchType.EAGER)
	private Suspend suspendAbility;
	
	public OnUnSuspend(){}
	
	public OnUnSuspend(Ability ability,Suspend suspendAbility){
		super(ability);
		this.suspendAbility = suspendAbility;
	}

	public OnUnSuspend(OnUnSuspend abilityTrigger) {
		super(abilityTrigger);
		this.suspendAbility = abilityTrigger.getSuspendAbility().clone();
	}
	
	@Override
	public void register() {
		suspendAbility.registerUnsuspendObserversObserver(getAbility());
		
	}
	
	public void unRegister() {
		suspendAbility.unRegisterUnsuspendObserversObserver(getAbility());
	}
	
	public OnUnSuspend clone() {
		return new OnUnSuspend(this);
	}

	public Suspend getSuspendAbility() {
		return suspendAbility;
	}

	public void setSuspendAbility(Suspend suspendAbility) {
		this.suspendAbility = suspendAbility;
	}
	
	

}
